package com.code.day19;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo04HashMap {

    public static void main(String[] args) {
        HashMap<String, String> map1 = new HashMap<>();
        map1.put("郭靖","黄蓉");
        map1.put("杨过","小龙女");
        map1.put("张三丰", "郭襄");
        map1.put("张无忌","赵敏");
        map1.put("涛哥","三上");

        //获取所有的键值对对象(Map.Entry)
        Set<Map.Entry<String, String>> set = map1.entrySet();
        //遍历set集合,将所有的键值对对象遍历出来
        for (Map.Entry<String, String> entry : set) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"..."+value);
        }
    }
}
